using System.Collections.Generic;
using UnityEngine;

public class HUDManager 
{
  


    private Dictionary<GameObject, List<HUDItem>> dic = new Dictionary<GameObject, List<HUDItem>>();

    public HUDItem Add(GameObject MountPoint, GameObject hudObj, Transform root)
    {
        HUDItem go = HUDItem.Create(hudObj);
        go.Show(root);
        if (dic.ContainsKey(MountPoint))
        {
            dic[MountPoint].Add(go);
        }
        else
        {
            dic.Add(MountPoint, new List<HUDItem> {go});
        }

        return go;
    }

    public void RemoveType(GameObject MountPoint, GameObject hudObj)
    {
        var item = dic[MountPoint].Find((t) => t.item == hudObj);
        dic[MountPoint].Remove(item);
    }

    public void Remove(GameObject MountPoint)
    {
     
        dic.Remove(MountPoint);
    }

    public Dictionary<GameObject, List<HUDItem>> Get()
    {
        return dic;
    }
}